import request from 'utils/request'
/**
 * 获取文章列表
 * @param {*} params
 * @returns
 */
export const getArticleList = (params = {}) => {
  return request({
    method: 'GET',
    url: '/mp/articles',
    params,
  })
}
/**
 *  删除文章
 * @param {*} id
 * @returns
 */
export const DelArticleList = (id) => {
  return request({
    method: 'DELETE',
    url: `/mp/articles/${id}`,
  })
}

export const getArticle = (id) => {
  return request({
    method: 'GET',
    url: `/mp/articles/${id}`,
  })
}
/**
 * 根据id 修改文章详情
 * @param {*} id
 * @param {*} data
 * @param {*} draft
 * @returns
 */
export const editArticleById = (id, data, draft = false) => {
  return request({
    method: 'PUT',
    url: `/mp/articles/${id}`,
    params: {
      draft,
    },
    data,
  })
}
